/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
                       Matthias Butz <matze@odinms.de>
                       Jan Christian Meyer <vimes@odinms.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package server;

import java.util.ArrayList;
import java.util.List;
import tools.Pair;

/**
 *
 * @author Patrick/PurpleMadness
 */
public class MapleAchievements {

    private List<Pair<Integer, MapleAchievement>> achievements = new ArrayList<Pair<Integer, MapleAchievement>>();
    private static MapleAchievements instance = null;

    protected MapleAchievements() {
        achievements.add(new Pair<Integer, MapleAchievement>(1, new MapleAchievement("Level 2 Congratz", 250, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(2, new MapleAchievement("Level 10 Congratz", 500, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(3, new MapleAchievement("Level 30 Congratz", 1000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(4, new MapleAchievement("Level 70 Congratz", 1500, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(5, new MapleAchievement("Level 120 Congratz", 2000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(6, new MapleAchievement("Level 200 Congratz", 5000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(7, new MapleAchievement("Got 1 fame", 250, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(8, new MapleAchievement("got 10 Fame", 500, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(9, new MapleAchievement("got 50 fame", 1000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(10, new MapleAchievement("got 100 fame", 2000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(11, new MapleAchievement("got 500 Fame", 5000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(12, new MapleAchievement("got 1000 fame", 10000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(13, new MapleAchievement("got 1337 fame", 13337, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(14, new MapleAchievement("said cc plz", 10000, false, true)));
        achievements.add(new Pair<Integer, MapleAchievement>(15, new MapleAchievement("said L337 failz", 10000, false, true)));
        achievements.add(new Pair<Integer, MapleAchievement>(16, new MapleAchievement("said HoldenMs sux", 100000, false, true)));
        achievements.add(new Pair<Integer, MapleAchievement>(17, new MapleAchievement("got over 99k dmg on one monster", 5000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(18, new MapleAchievement("rebirted", 10000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(19, new MapleAchievement("killed a Boss", 5000, false)));
        achievements.add(new Pair<Integer, MapleAchievement>(20, new MapleAchievement("said noob", 250, false, true)));
        achievements.add(new Pair<Integer, MapleAchievement>(21, new MapleAchievement("using a Facial Expresstion", 250, false)));
    }

    public static MapleAchievements getInstance() {
        if (instance == null) {
            instance = new MapleAchievements();
        }
        return instance;
    }

    public MapleAchievement getById(int id) {
        for (Pair<Integer, MapleAchievement> achievement : this.achievements) {
            if (achievement.getLeft() == id) {
                return achievement.getRight();
            }
        }
        return null;
    }

    public Integer getByMapleAchievement(MapleAchievement ma) {
        for (Pair<Integer, MapleAchievement> achievement : this.achievements) {
            if (achievement.getRight() == ma) {
                return achievement.getLeft();
            }
        }
        return null;
    }
}